#ifndef _IDT_H
#define _IDT_H

#include <stdint.h>

struct idt_desc 
{
    uint16_t offset_1; // offset bits 0..15
    uint16_t selector; // selector thats in our GDT (Global Descriptor Table)
    uint8_t zero; // zero bytes
    uint8_t type_attr; // Descriptor type and attributes
    uint16_t offset_2; // offset bits 16..31
} 
__attribute__((packed)); 

struct idtr_desc
{
    uint16_t limit;  // Size of IDT minus one
    uint32_t base; // Base address of IDT
}
__attribute__((packed)); 

struct interrupt_frame
{
    uint32_t edi;
    uint32_t esi; 
    uint32_t ebp; 
    uint32_t reserved; 
    uint32_t ebx; 
    uint32_t edx; 
    uint32_t ecx; 
    uint32_t eax; 

    uint32_t ip; // program counter
    uint32_t cs; 
    uint32_t flags;
    uint32_t esp; 
    uint32_t ss; 
}
__attribute__((packed)); 

typedef void* (*ISR80H_COMMAND)(struct interrupt_frame* frame); 

void idt_init(); 
void enable_interrupts(); 
void disable_interrupts(); 
void isr80h_register_command(const int command, ISR80H_COMMAND command_func); 

#endif 